import sqlite3


def excute_sqlite(path, sql, params=None):
    try:
        conn = sqlite3.connect(path)
        cursor = conn.cursor()
        if params is not None:
            cursor.execute(sql, params)
        else:
            cursor.execute(sql)
        conn.commit()
        conn.close()
    except Exception as e:
        print(e)


def query_sqlite(path, sql, params=None):
    try:
        conn = sqlite3.connect(path)
        cursor = conn.cursor()
        if params is not None:
            cursor.execute(sql, params)
            result = cursor.fetchall()
        else:
            cursor.execute(sql)
            result = cursor.fetchall()
        conn.commit()
        conn.close()
        return result
    except Exception as e:
        print(e)